<?php $this->load->view('backend/header'); ?>

<body class="black">

<?php $this->load->view('backend/top'); ?>
<?php $this->load->view('backend/slidebar'); ?>
	<!-- Style customize -->
	<style>
		#h1_top{
			margin-bottom:10px;
		}
	</style>
	
	<!-- Home page -->
	<input type='hidden' value='protfolio' class='page' />
	
	<!-- CONTENT -->
	<div id="content">
		<h1 id='h1_top'><img src="<?php echo $template_url.'images/' ?>/icons/posts.png" alt="">Edit protfolio image</h1>	
		
		<!-- Success notification -->
		<?php if(isset($error) && $error === 0): ?>
		<div class="notif success">
            <strong>Success :</strong>  Upload image success
            <a href="#" class="close"></a>
        </div>
        <?php endif; ?>
        
        <!-- Success notification -->
        <?php if(isset($error) && $error !== 0): ?>
		<div class="notif error">
            <strong>Error :</strong>   <?php echo $error ?>
            <a href="#" class="close"></a>
        </div>
        <?php endif; ?>			
		
		<div class="bloc">
			<div class="title"> <?php echo $protfolio[0]['name'] ?> </div>
			<form method='POST' action='' id='form' enctype="multipart/form-data">
			<div class="content">
				
				<table>
					<tbody>
						<input type='hidden' value='update' name='update' id='update' />

						<!-- AddNewImage -->
						<tr>
							<td class="picture" style="width: 140px;">
								<a href="#" class="zoombox">
									<img src="<?php echo $template_url_frontend.'images/white_image.png' ?>" alt="" width=80 height=80> 
								</a>
							</td>
							
							<td><a href="#">New Image</a></td>
							
							<td>
								<div class="input" id='input_file'>
						            <label for="file">Upload a file</label>
						            <input type="file" name="newfile0" class='upload_file'>
						        </div>
							</td>
							
							<td class="actions" style='text-align: center'>
								<a href="javascript:void(0)" title="Add new content" id='add_image'>
									<img src="<?php echo $template_url_frontend.'images/add_new.png' ?>" alt="" width=25 height=25>
								</a>						            
							</td>
						</tr>
						<!-- EndAddNewImage -->

						<!-- Show all image in render -->
						<?php if( is_array($image)  ): ?>
						<?php foreach($image as $key=>$item): ?>
						<?php
							 $link_image = $template_url_frontend.'images/upload/'.($item['image_url']);
							 $link_edit = base_url('admin/edit_image?id='.$item['id']); 
						?>
						<tr id='<?php echo 'row_'.$item['id'] ?>'>
							<td class="picture" style="width: 140px;"><a
								href="#" class="zoombox"><img
									src="<?php echo $link_image ?>" alt="" width=80 height=80> </a></td>
									
							<td><a href="#"><?php echo $item['image_url']  ?></a></td>
							
							<td>
								<div class="input">
						            <label for="file">Upload a file</label>
						            <input type="file" name="file<?php echo $item['id'] ?>" class='upload_file'>
						        </div>
							</td>
							
							<td class="actions" >
								<a class='delete' page='image' id='<?php echo $item['id'] ?>' href="javascript:void(0)" title="Delete this content">
									<img src="<?php echo $template_url.'images/' ?>icons/delete.png" alt=""> 
								</a>
							</td>
						</tr>
						<?php endforeach; ?>
						<?php endif; ?>
						<!-- End show all image in render -->
					</tbody>
				</table>
				<div class="submit" style='text-align: center; margin-top:10px;'>
				    <input type="submit" value="Save new" class="button black" id='update' name='update'>
				</div>	
				<input type='hidden' name='num_file' id='num_file' value='1' />
				</form>
			</div>
		</div>
	</div>
</body>
</html>
